Repository navigation
perf: skip SDK tracing without span processors - #430
Merged
Merged
Conversation
Preserve an external provider installed before bootstrap. Otherwise pass a local NoOpTracerProvider to framework and custom instrumentors without consuming the global registration slot. Keep SDK providers for configured span processors and leave external provider shutdown to its owner. Metrics-only and external-provider warning regressions failed first. Both OTLP exporter protocols still record and export. FastAPI/Litestar HTTP tests verify metrics collection and provider setup before/after bootstrap. Local Python 3.14.7 metrics-only ASGI benchmark: 500 warmup requests, seven rounds of 5000 requests, median elapsed request time. Metrics used ConsoleMetricExporter with an in-memory output stream to exclude network I/O. Logging, Prometheus and health routes disabled. Same harness and environment before/after: - FastAPI: 148.83 -> 108.39 us/request - Litestar: 108.17 -> 77.70 us/request Validation: 628 tests passed with 100% coverage; lint, ty and strict docs build passed. Standards and spec reviews found no remaining issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Metrics-only bootstrap previously installed an SDK tracer provider and recorded spans that had no processor to consume them. Build the SDK provider only when a span processor is configured. Otherwise pass a local no-op provider to framework and custom instrumentors, leaving the global registration slot available.
Preserve an external tracer provider installed before bootstrap and leave its shutdown to the application. Document setup order, late processor attachment, and the effect on JSON trace context.
Closes #402.
Breaking changes
Metrics-only bootstrap no longer installs an SDK tracer provider. Applications that add processors through
get_tracer_provider()after bootstrap must instead create and install their own SDK provider before bootstrap. Installing a provider later does not activate instrumentors already given a no-op provider. The same no-op policy applies when a trace exporter is missing and no other processor is configured; the missing-exporter warning remains.Measurements
Local Python 3.14.7, metrics-only in-process ASGI requests. Median of seven rounds of 5,000 requests after 500 warmup requests. Metrics used a console exporter writing to memory, excluding network I/O; logging, Prometheus, and health routes were disabled.
Validation
just test-ci: 628 passed, 100% coverage.just lint-ci: formatting, lint, and typechecking passed.just docs-build: strict build passed.